package com.monitor.service.parser.impl;

import com.monitor.model.ServerStatus;
import com.monitor.service.parser.MetricParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 进程指标解析器
 * 负责解析进程数量信息
 */
public class ProcessMetricParser implements MetricParser {
    private static final Logger logger = LoggerFactory.getLogger(ProcessMetricParser.class);

    @Override
    public void parse(String commandOutput, ServerStatus status) {
        try {
            // 解析进程数量
            String processCount = commandOutput.trim();
            status.setProcessCount(processCount);
        } catch (Exception e) {
            logger.error("解析进程数量失败: {}", e.getMessage());
            status.setProcessCount("解析错误");
        }
    }
} 